import { Parser } from "./parser";

function main() {
    const parser = new Parser();
    let ast = null;
    //ast = parser.parse(` set( LOCAL_FIELD, op_cat(op_cat(op_cat(op_cat(op_cat(op_cat("PREV.CONTR", VM), "EMP.CONTR"), FM), "PREV.CONTR"), VM), "EMP.CONTR"));`);
    //ast = parser.parse(` set( CREDIT_ACCOUNT, aGet( R_NEW, (11) ));`);
    //ast = parser.parse(` set( R_USIRAC_IRA_DETAILS,  (12),  (0),  (0), op_sub(get( R_USIRAC_IRA_DETAILS, 12L, 0, 0),  CREDIT_AMOUNT));`);
    //ast = parser.parse(` set( MATURITY_DATE, get( PROXY_PROPERTY_RECORD, 8L, 0, 0)); `);
    //ast = parser.parse(` set( IRA_ACCT_CCY,  FMP,  (-1),  (0), get( R_ACCOUNT, 8L, 0, 0)); `);
    //ast = parser.parse(` set( TYPE_BENEFICIARY, "Spouse"); `);
    //ast = parser.parse(` set( CONTR_END_DATE, op_add(fGet( TODAY, (1), (4)), 1L)); `);
    //ast = parser.parse(` set( PREV_END_DATE, op_cat(fGet( TODAY,  (1),  (4)),  PREV_END_DATE)); `);
    //ast = parser.parse(` set( queryDetails, (9), (0), (0), LOWER( MY_OPTIONAL_FIELDS)); `);
    //ast = parser.parse(` set( queryDetails, (12), (0), (0), FIELD( MY_TABLE, "$", (2), (1))); `);
    //ast = parser.parse(` set( DATE_OF_DEATH, get(aGet( R_NEW, (179) ), (1), DEATH_DATE_POS, 0)); `);
    ast = parser.parse(` set( R_US_LEGAL_DOCUMENT, (2), (0), (0), get(aGet( R_NEW,  (14)  ), (1),  ( COUNTER +1), 0)); `);
    console.log(JSON.stringify(ast, null, 2));
}
main();
